<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<?php $baseURL = Zend_Controller_Front::getInstance()->getBaseUrl(); ?>
<input type="hidden" id="baseUrl" value="<?php echo $baseURL; ?>"/>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Bookshop online</title>
        <link rel="stylesheet" rev="stylesheet" href="<?php  echo $baseURL; ?>/css/layout_home.css" type="text/css" media="all" />
        <link rel="stylesheet" rev="stylesheet" href="<?php  echo $baseURL; ?>/css/layout_home_2.css" type="text/css" media="all" />
        <script type="text/javascript" src="<?php  echo $baseURL; ?>/js/jquery-1.4.1.js"></script>
        <script type="text/javascript" src="<?php  echo $baseURL; ?>/js/commonfunctions.js"></script>
        <script type="text/javascript" language="javascript">
            $(document).ready(function()
            {
                $('#btSearch').mouseenter(function()
                {
                    $(this).css('background-color','#b6dbf9');
                }
                );
                    
                $('#btSearch').mouseout(function()
                {
                    $(this).css('background-color','#fad5a8');
                }
                );
                    
                $('#btCart').mouseenter(function()
                {
                    $(this).css('background-color','#b6dbf9');
                }
                );

                $('#btCart').mouseout(function()
                {
                    $(this).css('background-color','#e77902');
                }
                );
            }
            );

             /*Ẩn hiện menu danh mục sách*/
            $(document).ready(function()
            {
                $('#categorybook h4').mouseenter(function()
                {
                    $('#ul_category').css('display', 'block');
                }
                );

                $('#categorybook h4').mouseout(function()
                {
                    $('#ul_category').css('display', 'none');
                }
                );

                $('#ul_category').mouseenter(function()
                {
                    $('#ul_category').css('display', 'block');
                }
                );

                $('#ul_category li').mouseenter(function()
                {
                    $('#ul_category').css('display', 'block');
                }
                );

                $('#ul_category li').mouseout(function()
                {
                    $('#ul_category').css('display', 'none');
                }
                );
            }
            );

            function checkQuery()
            {
                var text=StandardString($('#textsearch').val());
                if(text.length >0)
                {
                    if(text.length>100)
                        text=text.substr(0,100);
                    $('#textsearch').val(text);
                    return true;
                }
                else
                    return false;
            }

            // change style of tag has class is .button
            $(document).ready(function()
            {
                $('.button').mouseenter(function()
                {
                    $(this).css('border-color','#3b78cd');
                }
                );

                $('.button').mouseout(function()
                {
                    $(this).css('border-color','#2a457f');
                }
                );
            }
            );

            function viewCart()
            {
                window.location=$('#baseUrl').val()+'/personal/cart/viewcart';
            }
        </script>
    </head>
    <body>
        <div id="header">
            <div id="header_logo">
                <img alt="logo"/>
            </div>
            <div id="header_sologan">
                <div>
                    Mang tri thức cộng đồng tới mọi người
                </div>
            </div>
            <div id="header_menu">
                <div>
                    <ul>
                        <li>
                            <a>Trợ giúp</a>
                        </li>
                        <li>
                            <span>|</span>
                            <a href="<?php echo $baseURL.'/community'; ?>">Cộng đồng</a>
                        </li>
                        <li>
                            <span>|</span>
                            <a href="<?php echo $baseURL.'/personal/activities'?>">Tài khoản</a>
                        </li>
                        <li>
                            <span>|</span>
                            <a href="<?php echo $baseURL ?>">Trang chủ</a>
                        </li>
                    </ul>
                    <br />
                    <br />
                    <div>
                        <?php
                            if($this->username !=null)
                            {
                        ?>
                            Xin chào <a href="<?php echo $baseURL .'/personal/index/index/user/'.$this->uid; ?>"> <?php echo $this->username; ?></a>
                            <span>|</span>
                            <a href="<?php echo $baseURL .'/default/index/logout'; ?>">Đăng xuất</a>
                        <?php
                            }
                            else
                            {
                        ?>
                            Xin chào.
                            <a href="<?php echo $baseURL .'/default/index/login' ?>"> Đăng nhập</a>
                            để nhận được nhiều tiện ích.<br /> Khách hàng lần đầu tiên xin
                            <a href="<?php echo $baseURL .'/default/index/register' ?>">Đăng ký</a>
                        <?php
                            }
                        ?>
                    </div>
                </div>
            </div>
        </div>

        <div class="clear"></div>
        
        <div id="div_search">
            <table id="searchbox">
            <tr>
                <td></td>
                <td width="100%">
                    <table id="tb_search" width="100%">
                        <tr>
                            <td width="60px">
                                Tìm kiếm
                            </td>
                            <form method="get" action="<?php echo $baseURL.'/default/book/search'; ?>">
                                <td width="140px">
                                    <select id="type" name="type">
                                        <option value="0">Tất cả các lĩnh vực</option>
                                         <?php
                                            foreach($this->category as $cat)
                                            {
                                                echo '<option value="'.$cat["_id"] .'">' . $cat["name"] . '</option>';
                                            }
                                        ?>
                                    </select>
                                </td>
                                <td>
                                    <input type="text" class="txt" name="textsearch" id="textsearch" />
                                </td>
                                <td width="10px">
                                    &nbsp;
                                </td>
                                <td width="50px">
                                    <input onclick="return checkQuery();" id="btSearch" type="submit" class="bt" value="Tìm"/>
                                </td>
                            </form>
                            <td width="100px">
                                <!-- <form method="get" action="<?php echo $baseURL .'/personal/cart/viewcart'; ?>" > -->
                                    <input onclick="viewCart()" id="btCart" type="submit" value=" Giỏ hàng" class="cart" />
                                <!--</form> -->
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        </div>

        <div class="clear"></div>

        <div id="body">
            <div id="body_left">
                <div id="categorybook">
                    <h4>Danh mục sách</h4>
                    <ul id="ul_category">
                        <?php
                            if (isset($this->category))
                            {
                                foreach($this->category as $cat)
                                {
                                    echo "<li class='book'>" . "<a href='". $baseURL."/default/book/index/type/".$cat["_id"] ."'>" . $cat["name"] . "</a></li>";
                                }
                            }
                        ?>
                    </ul>
                </div>
            </div>
            
            <?php echo $this->layout()->content; ?>
            
        </div>

        <div class="clear"></div>
        
        <div id="footer">
            Bookshop online. Copyright &copy; 2010<br />
            Nhóm phát triển seteam4t. Lớp công nghệ phần mềm k51 - Trường đại học Bách Khoa Hà Nội.<br />
            Email: <a href="mailto:seteam4t@gmail.com">seteam4t@gmail.com</a>&nbsp;&nbsp;&nbsp;&nbsp;
            Forum: <a href="http://www.cnpmk51-bkhn.org">http://www.cnpmk51-bkhn.org</a>
        </div>
    </body>
</html>